
<script lang="ts" setup>
import { useMainStore } from "@/store/main";
import { storeToRefs } from "pinia";
import { useRouter } from "vue-router";

const mainStore = useMainStore();
const { BarHeight } = storeToRefs(mainStore);
const router = useRouter();

const goBack = () => {
  router.back();
};
</script>

<template>
  <div
    :class="{
      header: true,
    }"
    :style="{
      '--BarHeight': BarHeight,
    }"
  >
    <div @click="goBack" class="header_left">
      <img src="@/assets/images/arrow-left.svg" />
    </div>
    <div class="header_center">
      <slot name="title"></slot>
    </div>
    <div class="header_right">
      <slot name="right"></slot>
    </div>
  </div>
</template>


<style scoped lang="scss">
@import "@/assets/style/constant.scss";
$_mru: calc(100vw / 375);

.header {
  background: #1a2c38;
  box-shadow: #0003 0 4px 6px -1px, #0000001f 0 2px 4px -1px;
  padding: 10 * $_mru 16 * $_mru;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 99;

  .header_left {
    > img {
      width: 24 * $_mru;
      height: 24 * $_mru;
    }
  }

  .header_center {
    color: #fff;
    text-align: center;
    font-feature-settings: "clig" off, "liga" off;
    font-family: PingFang SC, HarmonyOS;
    font-size: 17 * $_mru;
    font-weight: 500;
  }
  .header_right {
    width: 24 * $_mru;
    height: 24 * $_mru;
    position: relative;
  }
}

.headerAct {
  background-color: #f3f4f6;
  z-index: 99;
}
</style>
